﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;

namespace DatabaseChalleange.Data
{
    class MySqlWrapper
    {
        private MySqlConnection connection;

        public string Host { get; set; }
        public string User { get; set; }
        public string Password { get; set; }
        public string Db { get; set; }


        public MySqlWrapper(string host, string user, string password, string db)
        {
            this.Host = host;
            this.User = user;
            this.Password = password;
            this.Db = db;

            this.Initialize();
        }

        public MySqlWrapper()
        {
            this.Initialize();
        }

        public void Initialize()
        {
            this.Connection = 
                new MySqlConnection("server="+this.Host+"; user id="+this.User+"; password="+this.Password+
                    "; database="+this.Db+"");
        }

        public MySqlConnection Connection
        {
            get
            {
                return this.connection;
            }
            set
            {
                this.connection = value;
            }
        }
    }
}
